Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: add interval on AI backend request #426

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

VaibhavMalik4187
Copy link
Contributor

📑 Description

This commit introduces the ability to send the requests to the backend AI server at set intervals, independent of the reconciler's requeue requests.

To utilize this feature, the Interval field in the AI settings must be set in the k8sgpt configuration object. Also, the specified interval must be greater than or equal to the reconciler's requeue interval as the llm requests should be called after the reconciler executes k8sgpt analyze.

Fixes: #419

✅ Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

This commit introduces the ability to send the requests to the backend
AI server at set intervals, independent of the reconciler's requeue
requests.

To utilize this feature, the `Interval` field in the `AI` settings must
be set in the k8sgpt configuration object. Also, the specified interval
must be greater than or equal to the reconciler's requeue interval as
the llm requests should be called after the reconciler executes k8sgpt
analyze.

Fixes: k8sgpt-ai#419

Signed-off-by: VaibhavMalik4187 <[email protected]>
@VaibhavMalik4187
Copy link
Contributor Author

VaibhavMalik4187 commented Apr 30, 2024

@AlexsJones, @JuHyung-Son, where do we intend to use the responses obtained from repeatedly calling the AI backend?

@JuHyung-Son
Copy link
Contributor

what do you mean repeatedly calling the AI backend ?

@VaibhavMalik4187
Copy link
Contributor Author

what do you mean repeatedly calling the AI backend ?

Sorry if it's a naive question, I referred to the results obtained when the AI backend is called outside the reconciler loop (at set intervals). How do we plan to use them?

@JuHyung-Son
Copy link
Contributor

I'm sorry, but I don't think I understand the situation very well.
what is the situation that ai backend is called outside the reconciler loop? do we have that situation?

@VaibhavMalik4187
Copy link
Contributor Author

I'm sorry, but I don't think I understand the situation very well. what is the situation that ai backend is called outside the reconciler loop? do we have that situation?

No problem, I'll try again. So we're working on this feature to support calling the AI backend at set intervals independent of the reconciler loop.

I approached this feature in the following manner:

  1. Check if the user has set the k8sgptConfig.Spec.AI.Interval field and its duration is greater than k8sgptClient.ProcessAnalysis(k8sgptConfig, allowBackendAIRequest). If yes, then call repeatBackendRequest.
  2. repeatBackendRequest will call time.AfterFunc to call k8sgptClient.ProcessAnalysis(k8sgptConfig, allowBackendAIRequest) and obtain the results outside the reconciler loop at set intervals.
  3. At this step, we'll have the response obtained from the AI backend.
  4. What to do next??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: add interval on ai backend request
2 participants